package org.example.config;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.example.handler.InternalApiHandlerInterceptor;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Component
@Slf4j
@RequiredArgsConstructor
public class WebMvcConfig implements WebMvcConfigurer {


    private final InternalApiHandlerInterceptor internalApiHandlerInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        log.info("注册 InternalApiHandlerInterceptor");
        registry.addInterceptor(internalApiHandlerInterceptor)
                .addPathPatterns("/**");
    }
}